package link.dzl.consumer.receiver;

import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;


/**
 * 创建RabbitMQ的队列监听
 */
@Component
public class MsgReceiver {

    /**
     * @param msg 消息队列中的数据, 数据类型与发送的类型相对应
     */
    @RabbitListener(queues = "directQueue")
    @RabbitHandler
    public void process(String msg) {
        System.out.println("消息队列的接收方收到消息: " + msg);
    }

}